import { createApp } from 'vue'
import App from './App.vue'
const app = createApp(App)

import { I18n } from "./assets/lang/index.ts"
app.use(I18n)


import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/reset.css'
app.use(Antd)

import route from "./router/index"
app.use(route)


import { createPinia } from 'pinia'
app.use(createPinia())

import '@/tool/guard'

import { createComponents } from '@/component'
createComponents(app)

import './assets/iconfont/iconfont.css'
import './assets/iconfont/min-iconfont.css'
import { isAuth } from './tool/function'

app.directive('iscan', {
    mounted(el, binding) {
        var value = binding.value ? binding.value : []
        if(value && value.length > 0) {
            let can = isAuth(value)
            if(can == false) {
                if(value.includes('disabled')) {
                    el.disabled = !can
                }else {
                    el.parentNode.removeChild(el);
                }
            }
        }
    }
})

app.mount('#app')


